package com.lyfei.ydc.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lyfei.ydc.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
@TableName("t_reservation")
public class Reservation extends BaseEntity<Reservation> {
    private Long userId;
    private String userName;
    private String phone;
    private String address;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm")
    private Date reservationTime;
    private String remark;
    // 1-已预约 -1-已取消
    private Integer status;

    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {

        if (status == 1) {
            return "已预约";
        } else if (status == -1) {
            return "已取消";
        }
        return "";
    }
}
